package com.waitingsnow.modules.giftPlay.controller
{
import com.waitingsnow.core.mvc.controller.command;
import com.waitingsnow.modules.giftPlay.GiftPlayFacade;
import com.waitingsnow.modules.giftPlay.model.GiftPlayProxy;
import com.waitingsnow.modules.giftPlay.model.events.GiftPlayProxyEvent;
import com.waitingsnow.modules.giftPlay.view.GiftPlayView;

/**
 * 
 * @author waitingsnow
 * $Id: GiftPlayCommand.as 2 2012-05-17 10:10:03Z cgslendy@gmail.com $
 */
public class GiftPlayCommand extends command
{
	//==========================================================================
	//  Constructor
	//==========================================================================
	/**
	 * Constructs a new <code>GiftPlayCommand</code> instance.
	 * 
	 */
	public function GiftPlayCommand()
	{
		super();
	}
	
	//==========================================================================
	//  Variables
	//==========================================================================
	private var facade:GiftPlayFacade = GiftPlayFacade.getInstance();
	private var giftPlayProxy:GiftPlayProxy;
	private var giftPlayView:GiftPlayView;
	
	//==========================================================================
	//  Methods
	//==========================================================================
	override protected function execute():void
	{
		giftPlayView = facade.getContent(GiftPlayView.NAME) as GiftPlayView;
		giftPlayProxy = facade.getContent(GiftPlayProxy.NAME) as GiftPlayProxy;
		giftPlayProxy.addEventListener(GiftPlayProxyEvent.GET_GIFT_PLAY, 
			getGiftPlayHandler);
		giftPlayProxy.getGiftData();
	}
	
	//==========================================================================
	//  Event Handlers
	//==========================================================================
	private function getGiftPlayHandler(event:GiftPlayProxyEvent):void
	{
		giftPlayView.initDisplay();
	}
}
}